package com.cj.mobile.iabp.mvp.model.entity;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;

/**
 * @ProjectName: AptitudeAndroid
 * @Package: com.cj.mobile.iabp.mvp.model.entity
 * @ClassName: QuotePriceAreaInfo
 * @Description: 报价区域
 * @Author: WLY
 * @CreateDate: 2022/9/21 9:58
 */
public class QuotePriceAreaInfo implements Cloneable, Serializable {

    public QuotePriceAreaInfo(String areaId, String areaName) {
        this.areaId = areaId;
        this.areaName = areaName;
    }

    public QuotePriceAreaInfo() {
    }

    // 区域ID
    private String areaId = "";
    // 区域名称
    private String areaName;

    /*-----------------------------本地数据-----------------------------*/

    // 是否选中
    private boolean isChecked;
    // 是否允许点击
    private boolean isClick;

    public String getAreaId() {
        return areaId;
    }

    public void setAreaId(String areaId) {
        this.areaId = areaId;
    }

    public String getAreaName() {
        return areaName;
    }

    public void setAreaName(String areaName) {
        this.areaName = areaName;
    }

    public boolean isChecked() {
        return isChecked;
    }

    public void setChecked(boolean checked) {
        isChecked = checked;
    }

    public boolean isClick() {
        return isClick;
    }

    public void setClick(boolean click) {
        isClick = click;
    }


    /**
     * 深度克隆 拷贝的是值 字节数组输出 出入流 拷贝对象 内存地址不一样 改变其中一个对象的属性值，对应的原型对象属性值不发生变化
     */
    public QuotePriceAreaInfo deepClone() {
        try {
            ByteArrayOutputStream bos = new ByteArrayOutputStream();
            ObjectOutputStream oos = new ObjectOutputStream(bos);
            oos.writeObject(this);

            ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
            ObjectInputStream iis = new ObjectInputStream(bis);
            return (QuotePriceAreaInfo) iis.readObject();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }
}
